﻿package com.PlantVsZombies.common;

import java.awt.Graphics;
import java.io.Serializable;
import java.util.ArrayList;

import javax.swing.ImageIcon;

import com.PlantVsZombies.Bullet.Bullet;
import com.PlantVsZombies.constant.PlantType;

/**
 * 
 * 植物类：抽象类，所有植物的父类
 * 
 * @author wdd
 *
 */
public abstract class Plant extends Life implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public int x; // x坐标
	public int y; // y坐标
	public int life; // 生命值
	public boolean isAttacked = false;
	public boolean canShoot; // 是否可以发射子弹
	public transient ImageIcon plantImage; // 图片

	public abstract PlantType getType();// 获取自身类型

	public abstract void drawMe(Graphics g, int x2, int y2); // 画自己

	public abstract void shootBullet(); // 发射子弹

	ArrayList<Bullet> bullet = new ArrayList<Bullet>();

	// 获取子弹集合
	public ArrayList<Bullet> getBullet() {
		return bullet;
	}

	public void setBullet(ArrayList<Bullet> bullet) {
		this.bullet = bullet;
	}

	public boolean isAttacked() {
		return isAttacked;
	}

	public void setAttacked(boolean isAttack) {
		this.isAttacked = isAttack;
	}

	public ImageIcon getPlantImage() {
		return plantImage;
	}

	public void setPlantImage(ImageIcon plantImage) {
		this.plantImage = plantImage;
	}
	
}
